{% extends "base.html" %}
{% block title %}admin{% endblock %}
{% block head %}
<style type="text/css">
    .div1 {
        margin-top: 16px;
    }
</style>
{% endblock %}

{% block content %}
<div class="div1">
    <div>
        <h1 >用户信息表</h1>
    </div>
    <div class="d-flex flex-row-reverse">
        <p><a href="{{url_for('admin.add')}}" class="btn btn-info">新增用户</a></p>
    </div>
    {% if user_list %}
    <table class="table table-bordered">
        <thead>
            <th scope="col">#ID</th>
            <th scope="col">用户名</th>
            <th scope="col">邮箱</th>
            <th scope="col">注册时间</th>
            <th scope="col">登录时间</th>
            <th scope="col">操作</th>
        </thead>
        {% for user in user_list %}

        <tbody>
            <tr>
                <th scope="row" class="table-info">{{user.id}}</th>
                <td class="table-success">{{user.username}}</td>
                <td class="table-primary">{{user.email}}</td>
                <td class="table-primary">{{user.create_time}}</td>
                <td class="table-primary">{{user.last_login_time}}</td>
                <td class="table-warning">
                    <a class="btn badge-danger btn-sm" href="{{url_for('admin.delete',username=user.username)}}">
                        删除
                    </a>
                </td>
            </tr>

        </tbody>

        {% endfor%}
        {% else %}
        <h1>none</h1>
        {% endif %}
    </table>

</div>
{% endblock %}